/**
 * Created by Administrator on 2015/11/24.
 */
var mysql = require('mysql');
var Q = require('q');
var connection = mysql.createConnection({
    host     : 'localhost',
    user     : 'root',
    password : '',
    database : 'nodejs'
});
var getDepartments = function(parentId,callback){
    connection.connect();
    var sql = '';
    if(!parentId){//parentId === undefined
        sql = 'select * from department where parentId is null';
    }
    else{
        sql = 'select * from department where parentId = ' + parentId;
    }
    var query = connection.query(sql,function(err,rows,fields){
        if(err) throw err;

    })
};

